function [OUT] = Process(P) 
    dot_num = length(P(1).dots);
    for i= 1:length(P)
        A = zeros(dot_num, 1);
        for j = 1: dot_num
            x = P(i).dots(j).x;
            y = P(i).dots(j).y;
            A(j) = x*8 + y*33 - y*8 + x*33;
        end
        [~, Index]=sort(A, 'descend');
        A
        P(i).dots=P(i).dots(Index,:);
        for j = 1: dot_num
        end
        
        
    end

    B = repmat(Dot(0, 0), [dot_num, 1]);
    for j = 1: dot_num
        for i= 1:length(P)
            x = P(i).dots(j).x;
            y = P(i).dots(j).y;
            B(j).x = B(j).x + x;
            B(j).y = B(j).y + y;
        end
        B(j).x = B(j).x / length(P);
        B(j).y = B(j).y / length(P);
    end
    OUT = B;
    
    X = Population(8);
    X.dots = B;
    figure('NumberTitle', 'off', 'Name', 'final pop');
    Show(P)
    figure('NumberTitle', 'off', 'Name', 'final out');
    Show(X)
end

